import { http } from "@/utils/http/axios";
// 分页查询
export function getPageList(params = {}) {
	return http.request<API.Response.BasicResponse>(
		{
			url: "/system/dict/data/page",
			method: "get",
			params
		},
		{
			isTransformResponse: false
		}
	);
}
/**
 * 新增字典数据
 * @param 字典数据类型参数
 * @returns
 */
export function save(params = {}) {
	return http.request<API.Response.BasicResponse>(
		{
			url: "/system/dict/data",
			method: "POST",
			data: params
		},
		{
			isTransformResponse: false
		}
	);
}
/**
 * 修改字典数据
 * @param 修改字典数据参数
 * @returns
 */
export function update(params = {}) {
	return http.request<API.Response.BasicResponse>(
		{
			url: "/system/dict/data",
			method: "PUT",
			data: params
		},
		{
			isTransformResponse: false
		}
	);
}
/**
 * 删除字典数据
 * @param ids 删除字典数据
 * @returns
 */
export function remove(id: number | Array<number>) {
	return http.request<API.Response.BasicResponse>(
		{
			url: `/system/dict/data/${id}`,
			method: "DELETE"
		},
		{
			isTransformResponse: false
		}
	);
}
/**
 * 根据ID查询
 * @param id
 * @returns
 */
export function getDictData(id: number | undefined) {
	return http.request<API.Response.BasicResponse>(
		{
			url: `system/dict/data/${id}`,
			method: "get"
		},
		{
			isTransformResponse: false
		}
	);
}
// 刷新
export function syncDict() {
	return http.request<API.Response.BasicResponse>({
		url: `system/dict/type/sync`,
		method: "delete"
	});
}
